﻿using MediatR;
using T.Settlement.API.Application.Command.ExpensesCommand;
using T.Settlement.Repository.SettlementInterface;

namespace T.Settlement.API.Application.CommandHandlers.ExpensesHandler
{
    public class ExpensesUpdCommandHandler : IRequestHandler<ExpensesUpdCommand, int>
    {
        /// <summary>
        /// 仓储接口
        /// </summary>
        private readonly IExpensesSRepository _repository;
        /// <summary>
        /// 构造函数注入
        /// </summary>
        /// <param name="repository"></param>
        public ExpensesUpdCommandHandler(IExpensesSRepository repository)
        {
            _repository = repository;
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<int> Handle(ExpensesUpdCommand request, CancellationToken cancellationToken)
        {
            return await _repository.Update(request);
        }
    }
}
